package com.example.jw_web.pojo;

public class Result {

    private int code;
    private  String msg;
    private  Object data;

    public  Result()
    {}
    public Result(int code, String msg, Object data) {

        this.code=code;
        this.msg=msg;
        this.data=data;

    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getInfo() {
        return data;
    }

    public void setInfo(Object data) {
        this.data = data;
    }

    //成功的时候
    public static Result success(Object data)
    {
        return  new Result(200,"success",data);
    }
    public static Result success()
    {
        return  new Result(200,"success",null);
    }


    public  static Result fail(Object data)
    {
        return  new Result(401,"fail",data);
    }

    public  static  Result error(String msg)
    {
        return new Result(401,msg,null);
    }


    @Override
    public String toString() {
        return "Result{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", info=" + data +
                '}';
    }
}

